<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body>
    <script>
      async function getMoney() {
        var money = [100, 200, 300]
        for (let i = 0; i < money.length; i++) {
          await compute.exec().then(() => {
            console.log(money[i])
            //alert(i)
          })
        }
      } //关键字async/await  async告诉getMoney方法里面存在异步的操作，await放在具体异步操作（方法）前面，意思是等待该异步返回Promise才会继续后面的操作
    </script>
  </body>
</html>
